Pendo's JavaScript:
import {withPendoRN} from 'rn-pendo-sdk'
import {useRef} from 'react';
function RootNavigator(props) {
const navigationRef = useRef();
return (
<NavigationContainer
ref={navigationRef}
onStateChange={()=> {
const state = navigationRef.current.getRootState()
props.onStateChange(state);
}}
onReady ={()=>{
const state = navigationRef.current.getRootState()
props.onStateChange(state);
}}>
{MainStackScreen()}
</NavigationContainer>
)
};
export default withPendoRN(RootNavigator);
Pendo has above mentioned JavaScript code to integrate to React Native. Can someone please provide me some pointers as to how to convert this to TypeScript. My code is FC, with export const App: FC = () => {}
structure. Particularly the props
object?
useRef
withuseNavigationContainerRef
.onStateChange
. This is suboptimal but since Pendo has not provided types for this yet, it is my personal preference.So refactoring your code example: