Тип "Style" не удовлетворяет ограничению "NamedStyles | NamedStyles
import { StyleSheet, TextStyle, ViewStyle } from 'react-native';
import { IHandlerControl } from "../../ControlInterface";
export class StoresFeed{
storesFeed: any;
constructor(event: any,type: any){
this.storesFeed = {
screenEvent: event,
eventType: type
}
}
protected handlerFeed(event : IHandlerControl){
if(event.screenEvent === 'ui-change'){
type Style = {
feedTitle: TextStyle,
listTitle: TextStyle,
feedCont: [
title: TextStyle,
description: TextStyle,
price: TextStyle,
link: TextStyle
],
listCont: [
list: ViewStyle,
print: TextStyle
]
};
if(event.eventType == 0){
//Нулевое значение - это то, чего касается первоначальных элементов и компонентов
return StyleSheet.create<Style>({
feedTitle: {
color: '#ff0033',
fontSize: '140%',
fontWeight: 'bold',
marginLeft: '2%',
paddingTop: '1%',
paddingBottom: '1%'
},
listTitle: {
color: '#d83b01',
fontSize: '120%',
fontWeight: 'bold',
marginLeft: '2%',
paddingTop: '1%',
paddingBottom: '1%'
},
feedCont: [
title:{
fontSize: '130%',
fontWeight: 'italic'
},
description:{
fontSize: '100%'
},
price:{
fontSize: '110%',
fontWeight: 'bold'
}
link:{
fontSize: '90%',
fontWeight: 'normal'
}
],
listCont: [
list:{
fontSize: '100%'
},
print:{
color: '#201f1e',
fontWeight: 'italic'
}
]
});
}
}
}
public eventStart(){
this.handlerFeed(this.storesFeed);
}
}
Errors in code
- Type 'Style' does not satisfy the constraint 'NamedStyles | NamedStyles
- Type 'Style' is not assignable to type 'NamedStyles
- Types of property 'feedCont' are incompatible.
- Type '[title: TextStyle, description: TextStyle, price: TextStyle, link: TextStyle]' is not assignable to type 'TextStyle | ViewStyle | ImageStyle'.
- Type '[title: TextStyle, description: TextStyle, price: TextStyle, link: TextStyle]' has no properties in common with type 'ImageStyle'.
- Cannot find name 'title'.
- Cannot find name 'description'.
- Cannot find name 'price'.
- Cannot find name 'link'.
- Cannot find name 'list'.
- ',' expected.
- ',' expected.
- ',' expected.
- ',' expected.
- ',' expected.
- ',' expected.
- ',' expected.