Exemple #1
0
        protected object ExtractProperty(ReactStylesDiffMap props)
        {
            if (props.IsNull(Name) && s_defaultValues.TryGetValue(PropertyType, out var defaultFunc))
            {
                return(defaultFunc(_attribute));
            }

            return(props.GetProperty(Name)?
                   .ToObject(PropertyType));
        }
Exemple #2
0
        protected object ExtractProperty(ReactStylesDiffMap props)
        {
            if (props.IsNull(Name) && s_defaultValues.TryGetValue(PropertyType, out var defaultFunc))
            {
                return(defaultFunc(_attribute));
            }

            var prop = props.GetProperty(Name)?
                       .ToObject(PropertyType);

            if (prop == null && PropertyType.GetTypeInfo().IsValueType)
            {
                return(Activator.CreateInstance(PropertyType));
            }

            return(prop);
        }
Exemple #3
0
        protected object ExtractProperty(ReactStylesDiffMap props)
        {
            var defaultFunc = default(Func <ReactPropBaseAttribute, object>);

            if (props.IsNull(Name) && s_defaultValues.TryGetValue(PropertyType, out defaultFunc))
            {
                return(defaultFunc(_attribute));
            }
            try
            {
                return(props.GetProperty(Name)?
                       .ToObject(PropertyType));
            }
            catch (Exception ex)
            {
                Log.Error(ReactConstants.Tag, $"ExtractProperty failed, Name is {Method.Name}, PropertyType is {PropertyType}");
                throw ex;
            }
        }