Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated touchable components and added new Expo example with newer React Native version #10

Merged
merged 5 commits into from
Oct 22, 2020

Conversation

donni106
Copy link
Contributor

I had problems in a project, where I updated the React Native version. The fix is mentioned here: sohobloo/react-native-modal-dropdown#251 (comment)
There should not be two touchable components nested.
So I wanted to update the example in this repository. Problem was, that the update of React Native from 0.53.0 made problems. I decided to setup a new example with using Expo (latest SDK 38), which uses React Native 0.62.2.

After that I decided to resolve some open issues. I wanted to make the used touchable component less hard coded. So I created new props to pass components and props for the rendered rows of the dropdown and the main button.

Resolves #7

I encountered problems with using TouchableNativeFeedback on Android. I wanted this as default, but the onPress is not triggered for some weird reason. One can read about problems with that component in the web and also on the official documentation: https://reactnative.dev/docs/touchablenativefeedback

At the moment it only supports having a single View instance as a child node...

Maybe there is a way to fix that, but I did not find out.

With doing that, it was a small addition to add also new props to be passed for the Text, which is rendered when not passing renderRow.

Resolves #5

- ran `expo init`
- removed `.git` folder, which will be created by default
- copied example files
- updated App.js with example/index.js content
  - renamed Demo to App
  - added default export for App
- options is required, so it does not need a default value
  - updated Expo Demo values for options of dropdown 4
- removed wrapping `TouchableOpacity` in Expo Demo,
  which does not work anymore
  - this is needed for newer React Native versions
- the wrapping touchable component is set in `_renderItem`,
  there cannot be two touchables nested
- added props to be able to customize the components used

#7
- added `dropdownTextProps`, which can be used to add
  props to the text component that will be rendered, if the options
  for the dropdown were used without `renderRow`

#5
};

if (TOUCHABLE_ELEMENTS.find(name => name === row.type.displayName)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not work anymore with newer React Native versions. It was always undefined in my tests.

- index.js is not used because App.js is the entry point
@donni106
Copy link
Contributor Author

@siemiatj is there a way to assist you with managing pull requests? It would be nice to go on here and grab further issues.

@siemiatj siemiatj merged commit 71cb904 into siemiatj:master Oct 22, 2020
@donni106 donni106 deleted the feature/touchable-components branch February 11, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Component for select element Add optionalProps for <Text> for allowFontScaling={false}
2 participants