Search in sources :

Example 1 with ReactProp

use of com.facebook.react.uimanager.annotations.ReactProp in project react-native-fbads by callstack.

the class BannerViewManager method setSize.

@ReactProp(name = "size")
public void setSize(BannerView view, int size) {
    AdSize adSize = null;
    switch(size) {
        case 90:
            adSize = AdSize.BANNER_HEIGHT_90;
            break;
        case 250:
            adSize = AdSize.RECTANGLE_HEIGHT_250;
        case 50:
        default:
            adSize = AdSize.BANNER_HEIGHT_50;
    }
    view.setSize(adSize);
}
Also used : AdSize(com.facebook.ads.AdSize) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 2 with ReactProp

use of com.facebook.react.uimanager.annotations.ReactProp in project react-native-video by react-native-community.

the class ReactExoplayerViewManager method setSrc.

@ReactProp(name = PROP_SRC)
public void setSrc(final ReactExoplayerView videoView, @Nullable ReadableMap src) {
    Context context = videoView.getContext().getApplicationContext();
    String uriString = src.hasKey(PROP_SRC_URI) ? src.getString(PROP_SRC_URI) : null;
    String extension = src.hasKey(PROP_SRC_TYPE) ? src.getString(PROP_SRC_TYPE) : null;
    if (TextUtils.isEmpty(uriString)) {
        return;
    }
    if (startsWithValidScheme(uriString)) {
        Uri srcUri = Uri.parse(uriString);
        if (srcUri != null) {
            videoView.setSrc(srcUri, extension);
        }
    } else {
        int identifier = context.getResources().getIdentifier(uriString, "drawable", context.getPackageName());
        if (identifier == 0) {
            identifier = context.getResources().getIdentifier(uriString, "raw", context.getPackageName());
        }
        if (identifier > 0) {
            Uri srcUri = RawResourceDataSource.buildRawResourceUri(identifier);
            if (srcUri != null) {
                videoView.setRawSrc(srcUri, extension);
            }
        }
    }
}
Also used : Context(android.content.Context) ThemedReactContext(com.facebook.react.uimanager.ThemedReactContext) Uri(android.net.Uri) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 3 with ReactProp

use of com.facebook.react.uimanager.annotations.ReactProp in project gl-react-native by ProjectSeptemberInc.

the class GLCanvasManager method setPointerEvents.

@ReactProp(name = "pointerEvents")
public void setPointerEvents(GLCanvas view, @Nullable String pointerEventsStr) {
    if (pointerEventsStr != null) {
        PointerEvents pointerEvents = PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_"));
        view.setPointerEvents(pointerEvents);
    }
}
Also used : PointerEvents(com.facebook.react.uimanager.PointerEvents) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 4 with ReactProp

use of com.facebook.react.uimanager.annotations.ReactProp in project react-native-fbads by callstack.

the class NativeAdViewManager method setAdsManager.

@ReactProp(name = "adsManager")
public void setAdsManager(NativeAdView view, String adsManagerId) {
    NativeAdManager adManager = mReactContext.getNativeModule(NativeAdManager.class);
    NativeAdsManager adsManager = adManager.getFBAdsManager(adsManagerId);
    view.setNativeAd(adsManager.nextNativeAd());
}
Also used : NativeAdsManager(com.facebook.ads.NativeAdsManager) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Aggregations

ReactProp (com.facebook.react.uimanager.annotations.ReactProp)4 Context (android.content.Context)1 Uri (android.net.Uri)1 AdSize (com.facebook.ads.AdSize)1 NativeAdsManager (com.facebook.ads.NativeAdsManager)1 PointerEvents (com.facebook.react.uimanager.PointerEvents)1 ThemedReactContext (com.facebook.react.uimanager.ThemedReactContext)1