Summary: If source is null , source uri is null or source is not an array should respect style like in iOS
Reviewed By: yungsters
Differential Revision: D9018005
fbshipit-source-id: 5f695e8e3007c96e6004973e7fcbc6b57cc15249
Summary:
This patch is a bit of a hack job, but I'd argue it's necessary to dramatically improve the dev UX on Android devices. Somewhere in react-native, there's a shared SerialExecutor which AsyncStorage uses that is getting blocked, causing remote debugging to occasionally hang indefinitely for folks making AsyncStorage requests. This is frustrating from a dev UX perspective, and has persisted across several versions as far back as RN 0.44, and still remains on RN 0.54.
The issue seems to only happen on Android > 7+, which is likely because the ThreadPoolExecutor behavior changed in this version:
https://stackoverflow.com/questions/9654148/android-asynctask-threads-limitsFixes#14101
We've been using this patch in production for the past 4 months on our team by overriding the AsyncStorage native module. We use AsyncStorage extensively for offline data and caching.
You can test by compiling this commit version into a test react native repository that is set to build from source:
```sh
git clone https://github.com/dannycochran/react-native rnAsyncStorage
cd rnAsyncStorage
git checkout asyncStorage
cd ..
git clone https://github.com/dannycochran/asyncStorageTest
yarn install
cp -r ../rnAsyncStorage node_modules/react-native
react-native run-android
```
No documentation change is required.
https://github.com/facebook/react-native/pull/16905
[Android] [BUGFIX] [AsyncStorage] - Fix AsyncStorage causing remote debugger to hang indefinitely.
Pull Request resolved: https://github.com/facebook/react-native/pull/18522
Differential Revision: D8624088
Pulled By: hramos
fbshipit-source-id: a1d2e3458d98467845cb34ac73f2aafaaa15ace2
Summary:
@public
Adds an implementation of `YogaNodeProperties` that sets style properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.
Reviewed By: pasqualeanatriello
Differential Revision: D9042225
fbshipit-source-id: c7f2b24eaeddd1190755bec85a5034079bd2f492
Summary:
@public
Adds an implementation of `YogaNodeProperties` that accesses style and layout properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.
This needs further cleanup after experimenting, e.g. to codegen the offsets.
Reviewed By: pasqualeanatriello
Differential Revision: D8911723
fbshipit-source-id: 3c24b57eb545155878896ebb5d64d4553eb6bedc
Summary:
Here we introduce an abstraction over node property storage, in order to experiment with different approaches for Java/C integration.
- interface `YogaNodeProperties` as abstraction
- current JNI code factored into `YogaNodePropertiesJNI.java`
- `YogaNode` delegates all calls, no API changes
Reviewed By: astreet
Differential Revision: D8769448
fbshipit-source-id: e67327ce41fa047a51a986c652b3d59992a510e2
Summary: Using strings as keys for module names instead of actuall `.class` prevents additional class loading
Reviewed By: achen1
Differential Revision: D8955006
fbshipit-source-id: 12e6ad35fc35c969c05ca081976cc05b054f6821
Summary:
When native modules use `LazyReactPackage`, the modules themselves are not initialized. However, they still use the class names, causing the classes to load. This diff removes the need to perform any class loads. Any properties of the classes that are required are now populated in the `ReactModuleInfo` of that class.
Note that this diff itself does not prevent class loading since any references to `*.class` in `LazyReactpackage` needs to be removed in a consequent diff
Reviewed By: achen1
Differential Revision: D8950025
fbshipit-source-id: 80ddf7e1f33bf2af0db1bd262069795de77ec611
Summary: `ReactModuleInfoProvider` was using `Class` as the keys. This would make the classes to load. This change makes the map use canonicalName Strings of the classes, removing the need for the classes to load at this point.
Reviewed By: achen1
Differential Revision: D8944078
fbshipit-source-id: 4aa562d74d6ad3ebb9962b581d4e2f5e89d47ca6
Summary:
Added a check for null on `accessibilityStates`.
Now, if a null value is passed in to the prop, it simply does not do anything.
Reviewed By: achen1
Differential Revision: D9034714
fbshipit-source-id: caffa41a1d8b08d5358d085e4e268e8e6f1c9344
Summary:
We were seeing a bug where embedded feed stories showed the loading spinner forever until a scroll event occurred. Embedded feed stories are built on top of our RN + Litho integration which requires additional logic to support remeasuring the shadow tree when the intrinsic size of the litho component changes (aka wrap_content). Previously, we simply overrode requestLayout() of ReactLithoView to inform the shadow tree that that node needs to be dirtied -- in which case a
subsequent layout pass would resolve these changes. This worked fine in dev builds, but it turns out that release builds never received a subsequent layout pass. Dev builds apparently have a loop that dispatches view updates every second or so while release doesn't (not sure why), but that was the reason why the dev version eventually invalidated the views. The solution here is to simply always invoke a view update when any embedded Litho component requires a relayout.
Reviewed By: mdvacca
Differential Revision: D8983995
fbshipit-source-id: 53c528b3c00aad2bbe8e7f6360dc8e1594da1298
Summary:
An application could either have lazy, or non-lazy modules. This diff simply lets the individual reactPackages decide if they should be lazy or not, based on the variable in `ReactInstanceManagerBuilder`.
This diff also removed the method `setLazyNativeModules()` since an app can now have both native and non-native modules.
Reviewed By: achen1
Differential Revision: D8940026
fbshipit-source-id: 0399f4f39ad57f2b03e4dce117a9e2c28c4ed2b1
Summary:
In D8884991, I added a strings.xml file to react-native-github UI Manager resources.
Because this gets deployed to open source, and not all apps have the same Locale support that Facebook has, we temporarily don't want these strings to be translated.
I added `translatable = false` to the strings in this diff.
Reviewed By: fkgozali
Differential Revision: D9018766
fbshipit-source-id: 04d06478d0ac665fa02387e6df035c31522fdea6
Summary:
Context:
On Android, I am currently overriding the role description for TalkBack on certain Roles. Currently, these are done only in English.
I needed to add a checker that only overrides these role descriptions if the language of the phone is set
Changes:
* Added a language checker before I call setRoleDescription
* Put the strings into variables.
Note:
This is done to prioritize a codemod for accessibilityRole. Eventually, we hope to add support for other languages on these roles.
Reviewed By: blavalla
Differential Revision: D8884991
fbshipit-source-id: 3182eb5856ea57939fb25b17522d4b79ef2078e3
Summary:
Converting from double to int16_t is undefined behavior if the value
doesn't fit in int16_t.
Reviewed By: tmikov
Differential Revision: D8925246
fbshipit-source-id: 4cf57631686a4ce05546f8d30a46e3f9def3aee2
Summary:
Potential Fix to #19793
modified the code and tried to recreate the bug and was unable to. The red screen never popped up and nothing else seemed to be affected in a negative way.
[ANDROID] [BUGFIX] [FrameBasedAnimationDriver.java] - Safely unwrapping ReadableMap by defaulting to 0 if key not present.
Pull Request resolved: https://github.com/facebook/react-native/pull/19808
Differential Revision: D8960388
Pulled By: hramos
fbshipit-source-id: 400cc0467e041dfcf2d6b1ec0b61d716c2de159f
Summary:
This PR will bump NDK_TOOLCHAIN_VERSION to 4.9 or use GCC 4.9 to build C++ code. Once merged, we can bump folly to a newer version, which requires GCC 4.9.
Pull Request resolved: https://github.com/facebook/react-native/pull/19945
Reviewed By: fkgozali
Differential Revision: D8943282
Pulled By: hramos
fbshipit-source-id: d239ca67a08788b12e115a9d78443b13a10403f6
Summary:
Set clipChildren to false by default in ReactRootView.java so that Overflow: visible/hidden will work for the root view.
Moved sDefaultOverflowHidden from ReactViewGroup.java to ViewProps.java so that it can be used in both ReactViewGroup.java and ReactRootView.java.
Reviewed By: mdvacca
Differential Revision: D8727140
fbshipit-source-id: b593bed63e479cdbd22e4a025b936e6aeb28fc8c
Summary: Fix ReactHorizontalScrollView so that its children won't overflow. (Task: https://our.intern.facebook.com/intern/tasks/?t=31128239)
Reviewed By: achen1
Differential Revision: D8923947
fbshipit-source-id: 56c36b25c29a87a306d92544273603d0d086edc0
Summary:
Problem: The first ReactTextInputShadowNode layout calculation didn't consider the placeholder. When the layout with placeholder was actually being measured, its height was constraint by the previously calculated height, causing long placeholder content to be clipped.
Fix: Access the placeholder property in ReactTextInputShadowNode, set the dummyEditText's hint with placeholder before ReactTextInputShadowNode's first measurement.
Reviewed By: mdvacca
Differential Revision: D8903108
fbshipit-source-id: 8f3e518d0395ac875807f9ea989a0b5bbe4b2a26
Summary: Fix the calculation of offsetX in onLayout (ReactHorizontalScrollContainerView.java) that re-positions the updated layout. A private instance variable (oldWidth) is added in order to track the width difference between consecutive updates. (Issue report: https://github.com/facebook/react-native/issues/19979)
Reviewed By: mdvacca
Differential Revision: D8772780
fbshipit-source-id: 969dcead550f4a3d24d06416b63d960492b7a124
Summary:
Context:
After discussing with @[1038750002:yungsters], `currentViewStates` is a very ambiguous name for a prop, especially because there are only two possible values. From a developer's perspective, it makes more sense to just call them `accessibilityStates` because the main use for them is to add states to Talkback and Voiceover.
Defense for changing name in Android: The actual implementation of what we're changing under the hood in Native Code is abstracted away from developers using React Native, so as long as behavior is as they would expect, it makes more sense to change the name into a clear one regardless of how it is implemented.
Changes:
changed the Prop name from `currentViewStates` to `accessibilityStates` in the BaseViewManager file where the view property is being exposed.
Reviewed By: PeteTheHeat
Differential Revision: D8896389
fbshipit-source-id: 35dcd9239fae016b790e528947994681684bd654
Summary:
Currently, `AccessibilityInfo.setAccessibilityFocus` is only available on iOS. The same behaviour can be achieved on Android by dispatching the proper accessibility event. I implemented the same function for Android, to make life slightly more convenient for the developer.
Today, developers must write something like this:
```
if (Platform.OS === 'ios') {
AccessibilityInfo.setAccessibilityFocus(reactTag)
} else {
UIManager.sendAccessibilityEvent(reactTag, 8)
}
```
With this change, the following is enough for both Android and iOS:
```
AccessibilityInfo.setAccessibilityFocus(reactTag)
```
Pull Request resolved: https://github.com/facebook/react-native/pull/20229
Differential Revision: D8874107
Pulled By: mdvacca
fbshipit-source-id: a6ffd7bb89ce56d6d65b06419633a71dcf3d0733
Summary: Trying to see what it takes to get server snapshot tests working on android. This will be landed after fixing few things.
Reviewed By: achen1
Differential Revision: D8237948
fbshipit-source-id: 926555ba752171dac4e5814f5c8e5c2c173a82c7
Summary:
Added native android support for the prop accessibilityStates.
If 'selected' is passed in, it calls view.setSelected(true)
If 'disabled' is passed in, it calls view.setEnabled(false)
If both are passed in, both are set on the view.
Reviewed By: blavalla
Differential Revision: D8838407
fbshipit-source-id: a942dabcdc5d9e35f0316465e97317739a8b4b25