mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: ### Motivation - We need to exclude certain prop keys from conversion to `folly::dynamic` on android for our custom use case where we pass down `jsi::object`s with NativeState attached down the props Otherwise we run into crashes such as:  ### Changes - `dynamicFromValue` was marked as `noexcept` although it can throw, I removed the `noexcept` for correctness - Made it so you can pass down a filter function to exclude certain props from conversion (using the existing mechanism for that) - I think there is no way to pass a filter function and retain it in `RawProps` as that is constructed very early on in `UIManagerBinding` ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL] [ADDED] - Allow passing a filter function to `BaseViewProps` to exclude certain props on android from being dynamically casted Pull Request resolved: https://github.com/facebook/react-native/pull/48202 Test Plan: You can try modifying for example `ScrollViewProps.cpp` and pass a fourth argument to `ViewProps` to confirm that the filtering is working: ```cpp ScrollViewProps::ScrollViewProps( const PropsParserContext& context, const ScrollViewProps& sourceProps, const RawProps& rawProps) : ViewProps(context, sourceProps, rawProps, [&](const std::string& keyName){ return true; }), ``` Reviewed By: NickGerleman Differential Revision: D67088540 Pulled By: javache fbshipit-source-id: ed8cf5d773d357dfc54553f5ccf7adf27c781d56