Java Code Examples for com.facebook.react.uimanager.UIManagerModule#onBatchComplete()
The following examples show how to use
com.facebook.react.uimanager.UIManagerModule#onBatchComplete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextInputTest.java From react-native-GPay with MIT License | 5 votes |
@Test public void testPropsApplied() { UIManagerModule uiManager = getUIManagerModule(); ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application); rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100)); int rootTag = uiManager.addRootView(rootView); int textInputTag = rootTag + 1; final String hintStr = "placeholder text"; uiManager.createView( textInputTag, ReactTextInputManager.REACT_CLASS, rootTag, JavaOnlyMap.of( ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr)); uiManager.manageChildren( rootTag, null, null, JavaOnlyArray.of(textInputTag), JavaOnlyArray.of(0), null); uiManager.onBatchComplete(); executePendingChoreographerCallbacks(); EditText editText = (EditText) rootView.getChildAt(0); assertThat(editText.getHint()).isEqualTo(hintStr); assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37)); assertThat(editText.getHeight()).isEqualTo(20); }
Example 2
Source File: ReactTextTest.java From react-native-GPay with MIT License | 5 votes |
private ReactRootView createText( UIManagerModule uiManager, JavaOnlyMap textProps, JavaOnlyMap rawTextProps) { ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application); int rootTag = uiManager.addRootView(rootView); int textTag = rootTag + 1; int rawTextTag = textTag + 1; uiManager.createView( textTag, ReactTextViewManager.REACT_CLASS, rootTag, textProps); uiManager.createView( rawTextTag, ReactRawTextManager.REACT_CLASS, rootTag, rawTextProps); uiManager.manageChildren( textTag, null, null, JavaOnlyArray.of(rawTextTag), JavaOnlyArray.of(0), null); uiManager.manageChildren( rootTag, null, null, JavaOnlyArray.of(textTag), JavaOnlyArray.of(0), null); uiManager.onBatchComplete(); executePendingFrameCallbacks(); return rootView; }
Example 3
Source File: TextInputTest.java From react-native-GPay with MIT License | 4 votes |
@Test public void testPropsUpdate() { UIManagerModule uiManager = getUIManagerModule(); ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application); rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100)); int rootTag = uiManager.addRootView(rootView); int textInputTag = rootTag + 1; final String hintStr = "placeholder text"; uiManager.createView( textInputTag, ReactTextInputManager.REACT_CLASS, rootTag, JavaOnlyMap.of( ViewProps.FONT_SIZE, 13.37, ViewProps.HEIGHT, 20.0, "placeholder", hintStr)); uiManager.manageChildren( rootTag, null, null, JavaOnlyArray.of(textInputTag), JavaOnlyArray.of(0), null); uiManager.onBatchComplete(); executePendingChoreographerCallbacks(); EditText editText = (EditText) rootView.getChildAt(0); assertThat(editText.getHint()).isEqualTo(hintStr); assertThat(editText.getTextSize()).isEqualTo((float) Math.ceil(13.37)); assertThat(editText.getHeight()).isEqualTo(20); final String hintStr2 = "such hint"; uiManager.updateView( textInputTag, ReactTextInputManager.REACT_CLASS, JavaOnlyMap.of( ViewProps.FONT_SIZE, 26.74, ViewProps.HEIGHT, 40.0, "placeholder", hintStr2)); uiManager.onBatchComplete(); executePendingChoreographerCallbacks(); EditText updatedEditText = (EditText) rootView.getChildAt(0); assertThat(updatedEditText.getHint()).isEqualTo(hintStr2); assertThat(updatedEditText.getTextSize()).isEqualTo((float) Math.ceil(26.74f)); assertThat(updatedEditText.getHeight()).isEqualTo(40); }