Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork149
Open
Description
Bringing this over from Discord as requested by@MoOx. I'm basically not sure if this is the right way to use refs and if the external I've defined in the following example should be exposed in the repo:
openReactNative;openReactNavigation;// TODO: add to TextInput?externalelementToObj:TextInput.element =>Js.t({..})="%identity";[@react.component]letmake= (~navigation:Navigation.t)=> {openNavigation;let (text,onChangeText)=React.useState(()=>"Home");letref=React.useRef(Js.Nullable.null);React.useEffect0(()=> {letintervalId=Js.Global.setTimeout(()=>switch (ref->React.Ref.current->Js.Nullable.toOption) {|Some(_ref)=> _ref->elementToObj##focus()|None=>() },5000, );Some(()=>Js.Global.clearTimeout(intervalId)); }); <> <TouchableOpacity onPress={_=> navigation->Navigation.navigate("PrivacyPolicy")}> <Text> {React.string(text)} </Text> </TouchableOpacity> <TextInput ref onChangeText={text=> onChangeText(_=> text)} /> </>;};
Metadata
Metadata
Assignees
Labels
No labels