magicismight / react-native-root-modal

A pure JavaScript solution for react native`s modal component
MIT License
367 stars 56 forks source link

How to get focus on the Touchable component when the modal is opened? #22

Open marabej opened 6 years ago

marabej commented 6 years ago

Hi Exscuse me for the duplicate post, I made a mistake

I have two questions?

1) How to get focus on the Touchable component when the modal is opened. for example: Let's create a modal from a TouchableHighlight

<TouchableHighlight onPress={()=>{
  let modal = new ModalManager(<View style={modal container style}>
    <TouchableHighlight><Text>Button 1</Text></TouchableHighlight>
    <TouchableHighlight><Text>Button 2</Text></TouchableHighlight>
  </View>);
}}>
  <Text>Open Modal</Text>
</TouchableHighlight>

If there is no a touch screen, but the user has a physical keyboard, d-pad or TV Remote, How Can we make the Button 1 to get auto focussed when the modal is opened?

2) How can we force the focus to stay inside the modal? React-native have an excellent ability to move the focus between touchable components with D-pad, TV Remote or physical Keyboard (arrows), but the opened modal behaves like a part of the parent. It should be like a trully modal

best regards