получение ошибки инвариантного нарушения при использовании < List > и < FlatList > в реакции-родной на андроид

Я не смог найти оригинальную статью, но мне удалось восстановить эффект.

#region Attached Properties Boilerplate

    public static readonly DependencyProperty IsActiveProperty = DependencyProperty.RegisterAttached("IsActive", typeof(bool), typeof(ScrollIntoViewBehavior), new PropertyMetadata(false, OnIsActiveChanged));

    public static bool GetIsActive(FrameworkElement control)
    {
        return (bool)control.GetValue(IsActiveProperty);
    }

    public static void SetIsActive(
      FrameworkElement control, bool value)
    {
        control.SetValue(IsActiveProperty, value);
    }

    private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        var behaviors = Interaction.GetBehaviors(d);
        var newValue = (bool)e.NewValue;

        if (newValue)
        {
            //add the behavior if we don't already have one
            if (!behaviors.OfType<ScrollIntoViewBehavior>().Any())
            {
                behaviors.Add(new ScrollIntoViewBehavior());
            }
        }
        else
        {
            //remove any instance of the behavior. (There should only be one, but just in case.)
            foreach (var item in behaviors.ToArray())
            {
                if (item is ScrollIntoViewBehavior)
                    behaviors.Remove(item);
            }
        }
    }


    #endregion
<Style TargetType="Button">
    <Setter Property="Blah:ScrollIntoViewBehavior.IsActive" Value="True" />
</Style>
1
задан Andrew 11 March 2019 в 14:47
поделиться

1 ответ

Проверьте свою версию react-native-elements.

Эта ошибка обычно вызывается импортом чего-то, что не существует.

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, undefined,
You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

В версии 1+ компонент List устарел. Вы можете узнать больше о том, что устарело, а что нет, проверив блог зависимости . Также несколько реквизитов для ListItem также устарели, вы можете увидеть, какие из них здесь .

Тот факт, что вы используете List и roundAvatar, предполагает, что вы, возможно, пытаетесь использовать компоненты из версии 0.19.1, но с установленной версией 1+.

0
ответ дан Andrew 11 March 2019 в 14:47
поделиться
Другие вопросы по тегам:

Похожие вопросы: