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

App crashes when using percentage styles #77

Closed
LRNZ09 opened this issue Jan 24, 2018 · 9 comments
Closed

App crashes when using percentage styles #77

LRNZ09 opened this issue Jan 24, 2018 · 9 comments

Comments

@LRNZ09
Copy link

LRNZ09 commented Jan 24, 2018

Hi, I'm trying to use the library but it suddenly crash when I use percentage styles.

Please see the snack below (it's the same example given in README):
https://snack.expo.io/@lrnz09/estylesheet-percentage-crash

@vitalets
Copy link
Owner

@LRNZ09 Thanks for reporting! I've fixed it in 0.8.1.
In #32 I didn't consider that case. In math operations percents should be always calculated despite of native support in RN.

@AnthonyLamot
Copy link

I'm on 0.8.1 but it crashes all the same?

@vitalets
Copy link
Owner

vitalets commented Feb 7, 2018

@AnthonyLamot could you show Expo link or source code?

@vitalets vitalets reopened this Feb 7, 2018
@AnthonyLamot
Copy link

@vitalets was following a tutorial (https://github.com/EQuimper/youtubeMeetupAppReactNativeNode) and was making my own version of this file: https://github.com/EQuimper/youtubeMeetupAppReactNativeNode/blob/master/meetupme-mobile/src/screens/home/components/styles/MyMeetupsList.js

I switched back to ESS 0.0.4 cause I saw the guy who created the tutorial was using that one without issue.

@vitalets
Copy link
Owner

vitalets commented Feb 8, 2018

I see that expo-sdk-16 from the example uses RN 0.43.2 that does not support percent values natively. The support was added in RN 0.44 and EStyleSheet started to proxy pure percents in #32 since v0.5.0.
Now I understand that moving to native percents was not done properly. Because many developers are using earlier versions of RN <= 0.43 and the change broke backwards compatibility.

Currently I see 3 options:

  1. Check the RN version in runtime and proxy percent values only if version > 0.43. But I did not find the way to detect RN version. And it seems RN developers intentionally do not provide it.
  2. On app start make short runtime check is native percents are supported or not. I need to check will it have any performance issue.
  3. Do nothing, just clarify in docs that using percents with RN <= 0.43 requires EStyleSheet 0.4.0. Because RN already go far from 0.43 and made 10 releases.

@AnthonyLamot
Copy link

AnthonyLamot commented Feb 8, 2018

Cool. Honestly I'd go with option 3. I'll update my RN version in this project. 😄

@vitalets
Copy link
Owner

vitalets commented Feb 8, 2018

Ok! Let me know if it's ok after upgrading RN.

@AnthonyLamot
Copy link

I got it to work with:

  "dependencies": {
    "axios": "^0.17.1",
    "eslint": "^4.17.0",
    "expo": "^25.0.0",
    "react": "16.2.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
    "react-native-extended-stylesheet": "^0.8.0",
    "react-navigation": "^1.0.3"
  },

Hope that helps @vitalets !

@vitalets
Copy link
Owner

vitalets commented Feb 11, 2018

@AnthonyLamot 👍

txffxy pushed a commit to txffxy/react-native-extended-stylesheet that referenced this issue Feb 26, 2018
txffxy pushed a commit to txffxy/react-native-extended-stylesheet that referenced this issue Feb 26, 2018
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

No branches or pull requests

3 participants