예제 #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));
        }
예제 #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);
        }
예제 #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;
            }
        }