protected _buildInternalProps()

in src/native-common/View.tsx [327:407]


    protected _buildInternalProps(props: RX.Types.ViewProps) {
        this._internalProps = clone(props) as any;
        this._internalProps.ref = this._setNativeComponent;

        if (props.testId) {
            // Convert from testId to testID.
            this._internalProps.testID = this._internalProps.testId;
            delete this._internalProps.testId;
        }

        // Translate accessibilityProps from RX to RN, there are type diferrences for example:
        // accessibilityLiveRegion prop is number (RX.Types.AccessibilityLiveRegion) in RX, but
        // string is expected by RN.View
        const accessibilityProps = {
            importantForAccessibility: AccessibilityUtil.importantForAccessibilityToString(props.importantForAccessibility),
            accessibilityLabel: props.accessibilityLabel || props.title,
            accessibilityTraits: AccessibilityUtil.accessibilityTraitToString(props.accessibilityTraits),
            accessibilityComponentType: AccessibilityUtil.accessibilityComponentTypeToString(props.accessibilityTraits),
            accessibilityLiveRegion: AccessibilityUtil.accessibilityLiveRegionToString(props.accessibilityLiveRegion),
        };
        if (_isNativeMacOs && App.supportsExperimentalKeyboardNavigation && (props.onPress ||
                (props.tabIndex !== undefined && props.tabIndex >= 0))) {
            const macAccessibilityProps: MacComponentAccessibilityProps = accessibilityProps as any;
            if (props.tabIndex !== -1) {
                macAccessibilityProps.acceptsKeyboardFocus = true;
                macAccessibilityProps.enableFocusRing = true;
            }
            if (props.onPress) {
                macAccessibilityProps.onClick = props.onPress;
            }
        }
        this._internalProps = extend(this._internalProps, accessibilityProps);

        if (props.onLayout) {
            this._internalProps.onLayout = this._onLayout;
        }

        if (props.blockPointerEvents) {
            this._internalProps.pointerEvents = 'none';
        } else {
            if (props.ignorePointerEvents) {
                this._internalProps.pointerEvents = 'box-none';
            }
        }

        if (props.onKeyPress) {
            this._internalProps.onKeyPress = this._onKeyPress;
        }

        const baseStyle = this._getStyles(props);
        this._internalProps.style = baseStyle;
        if (this._mixinIsApplied) {
            const responderProps = {
                onStartShouldSetResponder: this.props.onStartShouldSetResponder || this.touchableHandleStartShouldSetResponder,
                onResponderTerminationRequest: this.props.onResponderTerminationRequest || this.touchableHandleResponderTerminationRequest,
                onResponderGrant: this.props.onResponderGrant || this.touchableHandleResponderGrant,
                onResponderMove: this.props.onResponderMove || this.touchableHandleResponderMove,
                onResponderRelease: this.props.onResponderRelease || this.touchableHandleResponderRelease,
                onResponderTerminate: this.props.onResponderTerminate || this.touchableHandleResponderTerminate,
            };
            this._internalProps = extend(this._internalProps, responderProps);

            if (!this.props.disableTouchOpacityAnimation) {
                const opacityValueFromProps = this._getDefaultOpacityValue(props);
                if (this._defaultOpacityValue !== opacityValueFromProps) {
                    this._defaultOpacityValue = opacityValueFromProps;
                    this._opacityAnimatedValue = new Animated.Value(this._defaultOpacityValue);
                    this._opacityAnimatedStyle = Styles.createAnimatedViewStyle({
                        opacity: this._opacityAnimatedValue,
                    });
                }
                this._internalProps.style = Styles.combine([baseStyle as any, this._opacityAnimatedStyle]);
            }

            this._internalProps.tooltip = this.props.title;
        }

        if (this.props.useSafeInsets) {
            this._internalProps.style = Styles.combine([this._internalProps.style, safeInsetsStyle]);
        }
    }