当前位置: 首页>>代码示例>>Java>>正文


Java ViewProps类代码示例

本文整理汇总了Java中com.facebook.react.uimanager.ViewProps的典型用法代码示例。如果您正苦于以下问题:Java ViewProps类的具体用法?Java ViewProps怎么用?Java ViewProps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ViewProps类属于com.facebook.react.uimanager包,在下文中一共展示了ViewProps类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTextDecorationLineUnderlineLineThroughApplied

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@Test
public void testTextDecorationLineUnderlineLineThroughApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(ViewProps.TEXT_DECORATION_LINE, "underline line-through"),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  UnderlineSpan underlineSpan =
      getSingleSpan((TextView) rootView.getChildAt(0), UnderlineSpan.class);
  StrikethroughSpan strikeThroughSpan =
      getSingleSpan((TextView) rootView.getChildAt(0), StrikethroughSpan.class);
  assertThat(underlineSpan instanceof UnderlineSpan).isTrue();
  assertThat(strikeThroughSpan instanceof StrikethroughSpan).isTrue();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ReactTextTest.java

示例2: setTextBreakStrategy

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY)
public void setTextBreakStrategy(@Nullable String textBreakStrategy) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
    return;
  }

  if (textBreakStrategy == null || "highQuality".equals(textBreakStrategy)) {
    mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
  } else if ("simple".equals(textBreakStrategy)) {
    mTextBreakStrategy = Layout.BREAK_STRATEGY_SIMPLE;
  } else if ("balanced".equals(textBreakStrategy)) {
    mTextBreakStrategy = Layout.BREAK_STRATEGY_BALANCED;
  } else {
    throw new JSApplicationIllegalArgumentException("Invalid textBreakStrategy: " + textBreakStrategy);
  }

  markUpdated();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactTextShadowNode.java

示例3: setFontWeight

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.FONT_WEIGHT)
public void setFontWeight(@Nullable String fontWeightString) {
  final int fontWeight;
  if (fontWeightString == null) {
    fontWeight = -1;
  } else if (BOLD.equals(fontWeightString)) {
    fontWeight = Typeface.BOLD;
  } else if (NORMAL.equals(fontWeightString)) {
    fontWeight = Typeface.NORMAL;
  } else {
    int fontWeightNumeric = parseNumericFontWeight(fontWeightString);
    if (fontWeightNumeric == -1) {
      throw new RuntimeException("invalid font weight " + fontWeightString);
    }
    fontWeight = fontWeightNumeric >= 500 ? Typeface.BOLD : Typeface.NORMAL;
  }

  if (mFontStylingSpan.getFontWeight() != fontWeight) {
    getSpan().setFontWeight(fontWeight);
    notifyChanged(true);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:RCTVirtualText.java

示例4: setTextDecorationLine

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.TEXT_DECORATION_LINE)
public void setTextDecorationLine(@Nullable String textDecorationLineString) {
  boolean isUnderlineTextDecorationSet = false;
  boolean isLineThroughTextDecorationSet = false;
  if (textDecorationLineString != null) {
    for (String textDecorationLineSubString : textDecorationLineString.split(" ")) {
      if ("underline".equals(textDecorationLineSubString)) {
        isUnderlineTextDecorationSet = true;
      } else if ("line-through".equals(textDecorationLineSubString)) {
        isLineThroughTextDecorationSet = true;
      }
    }
  }

  if (isUnderlineTextDecorationSet != mFontStylingSpan.hasUnderline() ||
      isLineThroughTextDecorationSet != mFontStylingSpan.hasStrikeThrough()) {
    FontStylingSpan span = getSpan();
    span.setHasUnderline(isUnderlineTextDecorationSet);
    span.setHasStrikeThrough(isLineThroughTextDecorationSet);
    notifyChanged(true);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:RCTVirtualText.java

示例5: setFontStyle

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.FONT_STYLE)
public void setFontStyle(@Nullable String fontStyleString) {
  final int fontStyle;
  if (fontStyleString == null) {
    fontStyle = -1;
  } else if (ITALIC.equals(fontStyleString)) {
    fontStyle = Typeface.ITALIC;
  } else if (NORMAL.equals(fontStyleString)) {
    fontStyle = Typeface.NORMAL;
  } else {
    throw new RuntimeException("invalid font style " + fontStyleString);
  }

  if (mFontStylingSpan.getFontStyle() != fontStyle) {
    getSpan().setFontStyle(fontStyle);
    notifyChanged(true);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:RCTVirtualText.java

示例6: setTextAlign

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.TEXT_ALIGN)
public void setTextAlign(@Nullable String textAlign) {
  if (textAlign == null || "auto".equals(textAlign)) {
    mAlignment = Gravity.NO_GRAVITY;
  } else if ("left".equals(textAlign)) {
    // left and right may yield potentially different results (relative to non-nodes) in cases
    // when supportsRTL="true" in the manifest.
    mAlignment = Gravity.LEFT;
  } else if ("right".equals(textAlign)) {
    mAlignment = Gravity.RIGHT;
  } else if ("center".equals(textAlign)) {
    mAlignment = Gravity.CENTER;
  } else {
    throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
  }

  notifyChanged(false);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:RCTText.java

示例7: setBorderRadius

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactPropGroup(names = {
    ViewProps.BORDER_RADIUS,
    ViewProps.BORDER_TOP_LEFT_RADIUS,
    ViewProps.BORDER_TOP_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_LEFT_RADIUS
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactScrollView view, int index, float borderRadius) {
  if (!YogaConstants.isUndefined(borderRadius)) {
    borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
  }

  if (index == 0) {
    view.setBorderRadius(borderRadius);
  } else {
    view.setBorderRadius(borderRadius, index - 1);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactScrollViewManager.java

示例8: setFontStyle

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
/**
/* 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);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ReactTextInputManager.java

示例9: testFontFamilyBoldItalicStyleApplied

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@Test
public void testFontFamilyBoldItalicStyleApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(
          ViewProps.FONT_FAMILY, "sans-serif",
          ViewProps.FONT_WEIGHT, "500",
          ViewProps.FONT_STYLE, "italic"),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  CustomStyleSpan customStyleSpan =
      getSingleSpan((TextView) rootView.getChildAt(0), CustomStyleSpan.class);
  assertThat(customStyleSpan.getFontFamily()).isEqualTo("sans-serif");
  assertThat(customStyleSpan.getStyle() & Typeface.ITALIC).isNotZero();
  assertThat(customStyleSpan.getWeight() & Typeface.BOLD).isNotZero();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactTextTest.java

示例10: setTextAlign

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactProp(name = ViewProps.TEXT_ALIGN)
public void setTextAlign(@Nullable String textAlign) {
  if (textAlign == null || "auto".equals(textAlign)) {
    mTextAlign = Gravity.NO_GRAVITY;
  } else if ("left".equals(textAlign)) {
    mTextAlign = Gravity.LEFT;
  } else if ("right".equals(textAlign)) {
    mTextAlign = Gravity.RIGHT;
  } else if ("center".equals(textAlign)) {
    mTextAlign = Gravity.CENTER_HORIZONTAL;
  } else if ("justify".equals(textAlign)) {
    // Fallback gracefully for cross-platform compat instead of error
    mTextAlign = Gravity.LEFT;
  } else {
    throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
  }
  markUpdated();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactTextShadowNode.java

示例11: setBorderRadius

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactPropGroup(names = {
    ViewProps.BORDER_RADIUS,
    ViewProps.BORDER_TOP_LEFT_RADIUS,
    ViewProps.BORDER_TOP_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_LEFT_RADIUS
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactViewGroup view, int index, float borderRadius) {
  if (!YogaConstants.isUndefined(borderRadius)) {
    borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
  }

  if (index == 0) {
    view.setBorderRadius(borderRadius);
  } else {
    view.setBorderRadius(borderRadius, index - 1);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactViewManager.java

示例12: setBorderRadius

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactPropGroup(names = {
        ViewProps.BORDER_RADIUS,
        ViewProps.BORDER_TOP_LEFT_RADIUS,
        ViewProps.BORDER_TOP_RIGHT_RADIUS,
        ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
        ViewProps.BORDER_BOTTOM_LEFT_RADIUS
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactTextView view, int index, float borderRadius) {
  if (!YogaConstants.isUndefined(borderRadius)) {
    borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
  }

  if (index == 0) {
    view.setBorderRadius(borderRadius);
  } else {
    view.setBorderRadius(borderRadius, index - 1);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactTextViewManager.java

示例13: setBorderRadius

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactPropGroup(names = {
    ViewProps.BORDER_RADIUS,
    ViewProps.BORDER_TOP_LEFT_RADIUS,
    ViewProps.BORDER_TOP_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_LEFT_RADIUS
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactHorizontalScrollView view, int index, float borderRadius) {
  if (!YogaConstants.isUndefined(borderRadius)) {
    borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
  }

  if (index == 0) {
    view.setBorderRadius(borderRadius);
  } else {
    view.setBorderRadius(borderRadius, index - 1);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactHorizontalScrollViewManager.java

示例14: setBorderRadius

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
@ReactPropGroup(names = {
    ViewProps.BORDER_RADIUS,
    ViewProps.BORDER_TOP_LEFT_RADIUS,
    ViewProps.BORDER_TOP_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
    ViewProps.BORDER_BOTTOM_LEFT_RADIUS
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderRadius(ReactImageView view, int index, float borderRadius) {
  if (!YogaConstants.isUndefined(borderRadius)) {
    borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
  }

  if (index == 0) {
    view.setBorderRadius(borderRadius);
  } else {
    view.setBorderRadius(borderRadius, index - 1);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactImageManager.java

示例15: setFontWeight

import com.facebook.react.uimanager.ViewProps; //导入依赖的package包/类
/**
/* 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();
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactTextShadowNode.java


注:本文中的com.facebook.react.uimanager.ViewProps类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。