com.facebook.react.uimanager.annotations.ReactProp Java Examples
The following examples show how to use
com.facebook.react.uimanager.annotations.ReactProp.
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: LayoutShadowNode.java From react-native-GPay with MIT License | 6 votes |
@ReactProp(name = ViewProps.FLEX_BASIS) public void setFlexBasis(Dynamic flexBasis) { if (isVirtual()) { return; } mTempYogaValue.setFromDynamic(flexBasis); switch (mTempYogaValue.unit) { case POINT: case UNDEFINED: setFlexBasis(mTempYogaValue.value); break; case AUTO: setFlexBasisAuto(); break; case PERCENT: setFlexBasisPercent(mTempYogaValue.value); break; } flexBasis.recycle(); }
Example #2
Source File: ReactBaseTextShadowNode.java From react-native-GPay with MIT License | 6 votes |
/** /* This code is duplicated in ReactTextInputManager /* TODO: Factor into a common place they can both use */ @ReactProp(name = ViewProps.FONT_WEIGHT) public void setFontWeight(@Nullable String fontWeightString) { int fontWeightNumeric = fontWeightString != null ? parseNumericFontWeight(fontWeightString) : -1; int fontWeight = UNSET; if (fontWeightNumeric >= 500 || "bold".equals(fontWeightString)) { fontWeight = Typeface.BOLD; } else if ("normal".equals(fontWeightString) || (fontWeightNumeric != -1 && fontWeightNumeric < 500)) { fontWeight = Typeface.NORMAL; } if (fontWeight != mFontWeight) { mFontWeight = fontWeight; markUpdated(); } }
Example #3
Source File: ReactTextInputManager.java From react-native-GPay with MIT License | 6 votes |
/** /* This code was taken from the method setFontStyle of the class ReactTextShadowNode /* TODO: Factor into a common place they can both use */ @ReactProp(name = ViewProps.FONT_STYLE) public void setFontStyle(ReactEditText view, @Nullable String fontStyleString) { int fontStyle = UNSET; if ("italic".equals(fontStyleString)) { fontStyle = Typeface.ITALIC; } else if ("normal".equals(fontStyleString)) { fontStyle = Typeface.NORMAL; } Typeface currentTypeface = view.getTypeface(); if (currentTypeface == null) { currentTypeface = Typeface.DEFAULT; } if (fontStyle != currentTypeface.getStyle()) { view.setTypeface(currentTypeface, fontStyle); } }
Example #4
Source File: ReactTextInputManager.java From react-native-GPay with MIT License | 6 votes |
@ReactProp(name = ViewProps.TEXT_ALIGN) public void setTextAlign(ReactEditText view, @Nullable String textAlign) { if (textAlign == null || "auto".equals(textAlign)) { view.setGravityHorizontal(Gravity.NO_GRAVITY); } else if ("left".equals(textAlign)) { view.setGravityHorizontal(Gravity.LEFT); } else if ("right".equals(textAlign)) { view.setGravityHorizontal(Gravity.RIGHT); } else if ("center".equals(textAlign)) { view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL); } else if ("justify".equals(textAlign)) { // Fallback gracefully for cross-platform compat instead of error view.setGravityHorizontal(Gravity.LEFT); } else { throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign); } }
Example #5
Source File: MergedAppBarLayoutManager.java From react-native-bottom-sheet-behavior with MIT License | 5 votes |
@ReactProp(name = "mergedColor") public void setMergedColor(AppBarLayout view, String mergedColor) { mMergedColor = mergedColor; if (mergedView != null) { setMergedBackgroundColor(); } }
Example #6
Source File: ReactMsgListManager.java From aurora-imui with MIT License | 5 votes |
@ReactProp(name = "sendBubble") public void setSendBubble(PullToRefreshLayout root, ReadableMap map) { int resId = mContext.getResources().getIdentifier(map.getString("imageName"), "drawable", mContext.getPackageName()); if (resId != 0) { mMessageList.setSendBubbleDrawable(resId); } }
Example #7
Source File: RCTLinearGradientViewManager.java From react-native-smart-barcode with MIT License | 5 votes |
@ReactProp(name = "width" ,defaultInt = 0) public void setWidth(LinearGradientView view, int width) { ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if((int) (width * density + 0.5f)>1) { params.width = (int) (width * density + 0.5f); params.height=view.size; } view.width=(int)(width*density+0.5f); view.setLayoutParams(params); }
Example #8
Source File: ReactTextInputManager.java From react-native-GPay with MIT License | 5 votes |
@ReactProp(name = "secureTextEntry", defaultBoolean = false) public void setSecureTextEntry(ReactEditText view, boolean password) { updateStagedInputTypeFlag( view, password ? 0 : InputType.TYPE_NUMBER_VARIATION_PASSWORD | InputType.TYPE_TEXT_VARIATION_PASSWORD, password ? InputType.TYPE_TEXT_VARIATION_PASSWORD : 0); checkPasswordType(view); }
Example #9
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@ReactProp(name = "selectionColor") public void setSelectionColor(Calendar view, String color) { if (color != null) { if (color.matches(COLOR_REGEX)) { view.setSelectionColor(Color.parseColor(color)); } else { throw new JSApplicationIllegalArgumentException("Invalid selectionColor property: " + color); } } }
Example #10
Source File: PiliStreamingViewManager.java From react-native-pili with MIT License | 5 votes |
@ReactProp(name = "camera") public void setCamera(AspectFrameLayout view, @Nullable String camera){ if(camera.equals("front")){ mMediaStreamingManager.switchCamera(CAMERA_FACING_ID.CAMERA_FACING_FRONT); }else if(camera.equals("back")){ mMediaStreamingManager.switchCamera(CAMERA_FACING_ID.CAMERA_FACING_BACK); }else{ } }
Example #11
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@ReactProp(name = "selectionMode") public void setSelectionMode(Calendar view, String mode) { if (mode != null) { if (mode.equals("none")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_NONE); } else if (mode.equals("single")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_SINGLE); } else if (mode.equals("multiple")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_MULTIPLE); } else { throw new JSApplicationIllegalArgumentException("Unknown selectionMode property: " + mode); } } }
Example #12
Source File: CirclesManager.java From react-native-android-circles with MIT License | 5 votes |
@ReactProp(name = "value", defaultFloat = 0) public void setValue(CircleProgressView view, float val) { if(_animated) view.setValueAnimated(val) ; else view.setValue(val); }
Example #13
Source File: RNJWPlayerViewManager.java From react-native-jw-media-player with MIT License | 5 votes |
@ReactProp(name = "displayTitle") public void setDisplayTitle(RNJWPlayerView view, Boolean prop) { if(view.displayTitle!=prop) { view.displayTitle = prop; if (view.mPlayer != null) { view.mPlayer.getConfig().setDisplayTitle(view.displayTitle); } } }
Example #14
Source File: ARTVirtualNode.java From react-native-GPay with MIT License | 5 votes |
@ReactProp(name = "transform") public void setTransform(@Nullable ReadableArray transformArray) { if (transformArray != null) { int matrixSize = PropHelper.toFloatArray(transformArray, sMatrixData); if (matrixSize == 6) { setupMatrix(); } else if (matrixSize != -1) { throw new JSApplicationIllegalArgumentException("Transform matrices must be of size 6"); } } else { mMatrix = null; } markUpdated(); }
Example #15
Source File: PiliStreamingViewManager.java From pili-react-native with MIT License | 5 votes |
@ReactProp(name = "camera") public void setCamera(AspectFrameLayout view, @Nullable String camera){ if(camera.equals("front")){ mMediaStreamingManager.switchCamera(CAMERA_FACING_ID.CAMERA_FACING_FRONT); }else if(camera.equals("back")){ mMediaStreamingManager.switchCamera(CAMERA_FACING_ID.CAMERA_FACING_BACK); }else{ } }
Example #16
Source File: ReactBaseTextShadowNode.java From react-native-GPay with MIT License | 5 votes |
@ReactProp(name = ViewProps.ALLOW_FONT_SCALING, defaultBoolean = true) public void setAllowFontScaling(boolean allowFontScaling) { if (allowFontScaling != mAllowFontScaling) { mAllowFontScaling = allowFontScaling; setFontSize(mFontSizeInput); setLineHeight(mLineHeightInput); setLetterSpacing(mLetterSpacingInput); markUpdated(); } }
Example #17
Source File: ReactBaseTextShadowNode.java From react-native-GPay with MIT License | 5 votes |
@ReactProp(name = ViewProps.TEXT_DECORATION_LINE) public void setTextDecorationLine(@Nullable String textDecorationLineString) { mIsUnderlineTextDecorationSet = false; mIsLineThroughTextDecorationSet = false; if (textDecorationLineString != null) { for (String textDecorationLineSubString : textDecorationLineString.split(" ")) { if ("underline".equals(textDecorationLineSubString)) { mIsUnderlineTextDecorationSet = true; } else if ("line-through".equals(textDecorationLineSubString)) { mIsLineThroughTextDecorationSet = true; } } } markUpdated(); }
Example #18
Source File: ReactDrawerLayoutManager_1d0b39_t.java From coming with MIT License | 5 votes |
@ReactProp(name = "drawerLockMode") public void setDrawerLockMode(ReactDrawerLayout view, @Nullable String drawerLockMode) { if (drawerLockMode == null || "unlocked".equals(drawerLockMode)) { view.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } else if ("locked-closed".equals(drawerLockMode)) { view.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } else if ("locked-open".equals(drawerLockMode)) { view.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN); } else { throw new JSApplicationIllegalArgumentException("Unknown drawerLockMode " + drawerLockMode); } }
Example #19
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@ReactProp(name = "firstDayOfWeek") public void setFirstDayOfWeek(Calendar view, String firstDayOfWeek) { if (firstDayOfWeek != null) { view.state().edit() .setFirstDayOfWeek(getFirstDayOfWeekFromString(firstDayOfWeek)) .commit(); } }
Example #20
Source File: ReactPropAnnotationSetterSpecTest.java From react-native-GPay with MIT License | 5 votes |
@Test(expected = RuntimeException.class) public void testUnsupportedPropValueType() { new BaseViewManager() { @ReactProp(name = "prop") public void setterWithUnsupportedValueType(View v, Date value) { } }.getNativeProps(); }
Example #21
Source File: ReactSwitchManager.java From react-native-GPay with MIT License | 5 votes |
@ReactProp(name = ViewProps.ON) public void setOn(ReactSwitch view, boolean on) { // we set the checked change listener to null and then restore it so that we don't fire an // onChange event to JS when JS itself is updating the value of the switch view.setOnCheckedChangeListener(null); view.setOn(on); view.setOnCheckedChangeListener(ON_CHECKED_CHANGE_LISTENER); }
Example #22
Source File: MergedAppBarLayoutManager.java From react-native-bottom-sheet-behavior with MIT License | 4 votes |
@ReactProp(name = "height") public void setHeight(AppBarLayout view, int height) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams(); params.height = (int) PixelUtil.toPixelFromDIP(height); view.setLayoutParams(params); }
Example #23
Source File: ARTSurfaceViewShadowNode.java From art with MIT License | 4 votes |
@ReactProp(name = ViewProps.BACKGROUND_COLOR, customType = "Color") public void setBackgroundColor(Integer color) { mBackgroundColor = color; markUpdated(); }
Example #24
Source File: Web3WebviewManager.java From react-native-web3-webview with MIT License | 4 votes |
@ReactProp(name = "allowUniversalAccessFromFileURLs") public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) { view.getSettings().setAllowUniversalAccessFromFileURLs(allow); }
Example #25
Source File: ReactPropertyProcessor.java From react-native-GPay with MIT License | 4 votes |
public RegularProperty(ReactProp prop) { mProp = prop; }
Example #26
Source File: BrightcovePlayerPosterManager.java From react-native-brightcove-player with MIT License | 4 votes |
@ReactProp(name = "accountId") public void setAccountId(BrightcovePlayerPosterView view, String accountId) { view.setAccountId(accountId); }
Example #27
Source File: ARTShapeShadowNode.java From react-native-GPay with MIT License | 4 votes |
@ReactProp(name = "strokeCap", defaultInt = CAP_ROUND) public void setStrokeCap(int strokeCap) { mStrokeCap = strokeCap; markUpdated(); }
Example #28
Source File: ReactVideoViewManager.java From react-native-video with MIT License | 4 votes |
@ReactProp(name = PROP_MUTED, defaultBoolean = false) public void setMuted(final ReactVideoView videoView, final boolean muted) { videoView.setMutedModifier(muted); }
Example #29
Source File: RCTCameraViewManager.java From react-native-camera-face-detector with MIT License | 4 votes |
@ReactProp(name = "torchMode") public void setTorchMode(RCTCameraView view, int torchMode) { view.setTorchMode(torchMode); }
Example #30
Source File: ReactPropConstantsTest.java From react-native-GPay with MIT License | 4 votes |
@ReactProp(name = "stringProp") public void setStringProp(View v, String value) { }