Based on the starter template found at https://github.com/react-native-training/reactxp-starter, I am just starting out with TypeScript!
The issue seems to be related to the type in the renderIf
function. I'm unsure where exactly the type should be specified for the renderIf
function to work properly. Any insights or guidance on this matter would be greatly appreciated! Especially since ReactXP serves as a thin layer over React Native.
Thank you!
/*
* This file showcases a simple ReactXP application.
*/
import RX = require('reactxp');
import renderIf = require('./util/renderIf');
//import { VirtualListView, VirtualListViewItemInfo } from 'virtuallistview';
const styles = {
// Styles definitions here...
};
// Component interfaces defined here...
class App extends RX.Component<QuestionProps, QuestionState> {
// Constructor and other methods implementation...
render(): JSX.Element | null {
// Render method code here...
}
}
export = App;
Error Message:
ERROR in [at-loader] ./src/App.tsx:154:18
TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof "/Users/app/src/util/renderIf"' has no compatible call signatures.
renderIf.ts
export default function renderIf(condition: any, content: any) {
if (condition) {
return content;
} else {
return null;
}
}