NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Compatibility issues with react-native-web 0.18

Open johnf opened this issue 3 years ago • 27 comments
trafficstars

Description

There are some breaking chaneges in react-native-web 0.18.0 which cause compilation failures

CodeSandbox/Snack link

N/A

Steps to reproduce

Upgrade to react-native-web 0.18

NativeBase Version

3.4.6

Platform

  • [ ] Android
  • [X] CRA
  • [ ] Expo
  • [ ] iOS
  • [ ] Next

Other Platform

No response

Additional Information

https://github.com/GeekyAnts/NativeBase/blob/master/src/utils/useResponsiveQuery/useResponsiveQuery.web.ts#L2

'react-native-web/dist/exports/StyleSheet/createCompileableStyle no longer exists in version 0.18

johnf avatar Jun 12 '22 17:06 johnf

Hi @johnf, Thanks for reporting the issue. We will look into this issue. We will add support for 0.18 in a later version. for now you can use 0.17

Viraj-10 avatar Jun 13 '22 07:06 Viraj-10

I'm eager to understand when this will land. We are running into issue with being unable to use certain latest versions of Expo modules which require react-native-web 0.18

duro avatar Jul 01 '22 18:07 duro

really hope nativebase can work well with rnw 0.18.x updates

exneval avatar Jul 11 '22 00:07 exneval

FYI if you use patch package to delete the relevant .web files, everything seems to work fine. No idea if this will cause any other issues. The RNW app I'm using this for isn't mission-critical for me, so caveat emptor for others.

johnf avatar Jul 11 '22 01:07 johnf

@johnf Mind posting your patch/** files from patch-package? We are running into the same issue. Error looks like this at the top:

Failed to compile.

/home/circleci/repo/node_modules/react-native/Libraries/Pressability/Pressability.js
Cannot find module: '../Utilities/Platform'. Make sure this package is installed.

You can install this package by running: yarn add ../Utilities/Platform.
"expo": "45.0.4",
    "expo-asset": "8.4.6",
    "expo-auth-session": "3.6.1",
    "expo-av": "11.2.3",
    "expo-gl": "11.3.0",
    "expo-linear-gradient": "11.3.0",
    "expo-localization": "13.0.0",
    "expo-random": "12.2.0",
    "expo-speech": "10.2.0",
    "expo-splash-screen": "0.15.1",
    "expo-status-bar": "1.3.0",
    "expo-structured-headers": "2.1.1",
    "expo-three": "6.1.0",
    ...
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.68.2",
    "react-native-web": "0.17.5",

theonetheycallneo avatar Jul 16 '22 10:07 theonetheycallneo

native-base+3.4.9.patch.txt

@theonetheycallneo Attached - You might need to clear your babel cache before it works. I basically just remove the .web files

johnf avatar Jul 23 '22 04:07 johnf

native-base+3.4.9.patch.txt

@theonetheycallneo Attached - You might need to clear your babel cache before it works. I basically just remove the .web files

applying this patch gets my app working again on latest expo 46, thanks!

danielantelo avatar Jul 26 '22 15:07 danielantelo

I'm looking forward to get this fixed. Especially in Expo the 0.18 has better support for live reload

dohomi avatar Aug 10 '22 08:08 dohomi

Is there an ETA for this? I'm guessing a large part of your users (the ones that use Expo) have this problem?

pors avatar Aug 10 '22 13:08 pors

We are working on this currently. Patch provided above won't affect most of the parts. although we suggest waiting for us to resolve this with a stable release. we have created an Issue on react-native-web for additional information. any suggestions and PR are welcome.

Viraj-10 avatar Aug 10 '22 14:08 Viraj-10

Hi Everyone, We have released v3.4.12-alpha.1 for react-native-web 0.18 and expo SDK 46 support.

Viraj-10 avatar Aug 12 '22 06:08 Viraj-10

Hi Everyone, We have released v3.4.12-alpha.1 for react-native-web 0.18 and expo SDK 46 support.

The newest version shows in the npm is still 3.4.12: native-base | Essential… | =surajahmedc… | 2022-08-12 | 3.4.12 | android

likeSo avatar Aug 12 '22 09:08 likeSo

Hi @likeSo, 3.4.12 is released just now with some hotfix. we have previously pushed rnw 0.18 changes with v3.4.12-alpha.1. So please specifically install this version for support for rnw 0.18 and SDK version 45 and above.

Viraj-10 avatar Aug 12 '22 09:08 Viraj-10

Hi @likeSo, 3.4.12 is released just now with some hotfix. we have previously pushed rnw 0.18 changes with v3.4.12-alpha.1. So please specifically install this version for support for rnw 0.18 and SDK version 45 and above.

Works for me! Thanks @Viraj-10

The only thing is that icons and font sizes have changed. Not sure if this is related to NB though.

pors avatar Aug 12 '22 11:08 pors

+1

lap888 avatar Aug 13 '22 02:08 lap888

@Viraj-10 I updated the nativebase package inside of the template starter of solito and it breaks visually a few things with icons and images. Especially Expo is not starting any longer without errors.

dohomi avatar Aug 13 '22 05:08 dohomi

Hi @dohomi, Can you provide some more details? Like Error logs and some snapshots for icons and images.

Viraj-10 avatar Aug 14 '22 03:08 Viraj-10

Hi @Viraj-10 I just figured out that there are several open PR to actually get the solito starter up and running. After manually going through the PRs I got the template up and running. I think best would be to merge the open PRs that things like image paths and package.json is working out of the box.

dohomi avatar Aug 14 '22 03:08 dohomi

Hi @dohomi, Thanks for letting us know. We will merge them soon after testing.

Viraj-10 avatar Aug 14 '22 03:08 Viraj-10

@Viraj-10 currently the version breaks the Storybook example with expo 46. It seems to be fixed for expo but not in combination with Storybook

dohomi avatar Aug 14 '22 09:08 dohomi

@Viraj-10 Which of the changes in 3.4.12 was supposed to fix the issue?

I'm still seeing the same problem

Failed to compile.

Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet/createCompileableStyle' in '.../node_modules/native-base/lib/module/utils/useResponsiveQuery'
ERROR in ./node_modules/native-base/lib/module/utils/useResponsiveQuery/useResponsiveQuery.web.js 8:53-127
Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet/createCompileableStyle' in '.../node_modules/native-base/lib/module/utils/useResponsiveQuery'

ERROR in ./node_modules/native-base/lib/module/utils/useResponsiveQuery/useResponsiveQuery.web.js 10:40-101
Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet/i18nStyle' in '.../node_modules/native-base/lib/module/utils/useResponsiveQuery'

ERROR in ./node_modules/native-base/lib/module/utils/useResponsiveQuery/useResponsiveQuery.web.js 12:15-74
Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet/compile' in '.../node_modules/native-base/lib/module/utils/useResponsiveQuery'

ERROR in ./node_modules/native-base/lib/module/utils/useResponsiveQuery/useResponsiveQuery.web.js 14:44-109
Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet/styleResolver' in '.../node_modules/native-base/lib/module/utils/useResponsiveQuery'

webpack compiled with 4 errors

johnf avatar Aug 14 '22 23:08 johnf

nm. Just realised the changes are in the alpha and not the release version. I've tested the alpha and all compiles nicely now. Will post again if I notice any other issues

johnf avatar Aug 15 '22 00:08 johnf

Just commenting here, indeed the best option for now is to keep with react-native-web 17, i will be checking in how i can help with some pr

RicardoBrito1938 avatar Aug 16 '22 08:08 RicardoBrito1938

Hi All, current PR in v3.4.12-alpha is temporary fix. We are working on stable fix which doesn't require rnw private files. we have released a alpha for those who wants to checkout expo 46 and rnw 0.18.

Viraj-10 avatar Aug 16 '22 08:08 Viraj-10

"native-base": "~3.4.12-alpha", this version should work with expo 46? my project is still crashing Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

Luca-Settle avatar Sep 05 '22 17:09 Luca-Settle

Do you have plans to update version 2.x of native-base to fix this issue as well? Or the only option (besides some possible maybe existed hacks) to use expo sdk 46 is to upgrade from version 2.x to 3.x?

michalpanek avatar Sep 06 '22 12:09 michalpanek

@Luca-Settle I just installed from the source branch, worked for me for a temp fix:

npm i git+https://github.com/GeekyAnts/NativeBase.git\#fix/react-native-web0.18

inform880 avatar Sep 13 '22 10:09 inform880

@inform880 It worked! Thanks!

YukiOmori avatar Sep 22 '22 05:09 YukiOmori

@Viraj-10 Any plans to release the fix?

Nasseratic avatar Sep 28 '22 07:09 Nasseratic

This fixed it for me thank you @inform880

zivc avatar Oct 02 '22 16:10 zivc

Hi All, This issue will be fixed in the next release of native-base. sorry for the delay.

Viraj-10 avatar Oct 19 '22 11:10 Viraj-10