-
Notifications
You must be signed in to change notification settings - Fork 67
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
RN Globalize not working when nested inside HoC #29
Comments
@joshswan I've tried to debug the problem but still haven't found the cause yet. Hope you can help. |
This is related to this React issue. Basically your HoC is implementing a |
@joshswan Thank you, it works. I thought I had to pass context properly somehow between HoC. Now simply adding locale from reducer in |
@joshswan Hi, could you take a look again in the demo repo? (I've add more example code) I've encountered the same error when globalize Components is nested inside a Navigator from I don't think it's the same issue as with |
I can finally solve the issue with Navigators by passing outer globalize context in |
Unfortunately I don't have much experience with |
Yes, that what I've done to solve the issue. Thank you for the help. |
Reproducible demo repo:
Expo React native project.
Description
When nested with higher-order-component functions (for example
connect
fromredux
, and various fromrecompose
), Components (FomattedMessages
, etc..) will only render once with initialFormattedWrapper
'slocale
, and won't re-render whenlocale
changesEnvironment
Steps to Reproduce
Clone demo repo,
yarn install
ornpm install
. Open Expo XDE, open repo project. Then run on Simulator or Devices of your choice.In
App.js
LocalizationWrapper
isFormattedWrapper
wrapped with reducer to store and changelocale
.ExampleComponent
is a normal React component.ExampleHoC
isExampleComponent
wrapped in a simpleconnect
from redux, no new props is added.Actual Behavior
When run, a saga will start changing
locale
betweenen
,th
,zh
every second.ExampleComponent
will change text accordingly, whileExampleHoC
stays the same.Expected Behavior
Higher-order-component
ExampleHoC
should re-render similar toExampleComponent
The text was updated successfully, but these errors were encountered: