public void updateProperties(int tag, CatalystStylesDiffMap props) { UiThreadUtil.assertOnUiThread(); ViewManager viewManager = mTagsToViewManagers.get(tag); if (viewManager == null) { throw new IllegalViewOperationException("ViewManager for tag " + tag + " could not be found"); } View viewToUpdate = mTagsToViews.get(tag); if (viewToUpdate == null) { throw new IllegalViewOperationException( "Trying to update view with tag " + tag + " which doesn't exist"); } viewManager.updateProperties(viewToUpdate, props); }
public void createView( int rootViewTagForContext, int tag, String className, @Nullable CatalystStylesDiffMap initialProps) { UiThreadUtil.assertOnUiThread(); ViewManager viewManager = mViewManagers.get(className); View view = viewManager.createView(mRootViewsContext.get(rootViewTagForContext), mJSResponderHandler); mTagsToViews.put(tag, view); mTagsToViewManagers.put(tag, viewManager); // Use android View id field to store React tag. This is possible since we don't inflate // React views from layout xmls. Thus it is easier to just reuse that field instead of // creating another (potentially much more expensive) mapping from view to React tag view.setId(tag); if (initialProps != null) { viewManager.updateProperties(view, initialProps); } }