الفرق بين المراجعتين ل"ReactNative/activityindicator"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
ط
 
(5 مراجعات متوسطة بواسطة مستخدمين اثنين آخرين غير معروضة)
سطر 1: سطر 1:
<noinclude>{{DISPLAYTITLE: ActivityIndicator في React Native}}</noinclude>
+
<noinclude>{{DISPLAYTITLE:المكون ActivityIndicator في React Native}}</noinclude>
 
يعرض مؤشّر تحميل دائريّ.
 
يعرض مؤشّر تحميل دائريّ.
  
 
==مثال==
 
==مثال==
 +
 +
* [https://snack.expo.dev/@hsoubwiki/activityindicator-class-component-example مثال لمكون الصنف (Class Component)]
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
import React, { Component } from 'react'
+
import React, { Component } from "react";
import {
+
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
  ActivityIndicator,
 
  AppRegistry,
 
  StyleSheet,
 
  Text,
 
  View,
 
} from 'react-native'
 
  
export default class App extends Component {
+
class App extends Component {
 
   render() {
 
   render() {
 
     return (
 
     return (
 
       <View style={[styles.container, styles.horizontal]}>
 
       <View style={[styles.container, styles.horizontal]}>
         <ActivityIndicator size="large" color="#0000ff" />
+
         <ActivityIndicator />
         <ActivityIndicator size="small" color="#00ff00" />
+
         <ActivityIndicator size="large" />
         <ActivityIndicator size="large" color="#0000ff" />
+
         <ActivityIndicator size="small" color="#0000ff" />
         <ActivityIndicator size="small" color="#00ff00" />
+
         <ActivityIndicator size="large" color="#00ff00" />
 
       </View>
 
       </View>
     )
+
     );
 
   }
 
   }
 
}
 
}
سطر 29: سطر 25:
 
   container: {
 
   container: {
 
     flex: 1,
 
     flex: 1,
     justifyContent: 'center'
+
     justifyContent: "center"
 +
  },
 +
  horizontal: {
 +
    flexDirection: "row",
 +
    justifyContent: "space-around",
 +
    padding: 10
 +
  }
 +
});
 +
 
 +
export default App;
 +
</syntaxhighlight>
 +
 
 +
* [https://snack.expo.dev/@hsoubwiki/activityindicator-function-component-example مثال لمكون الدالة (Function Component)]
 +
<syntaxhighlight lang="javascript">
 +
import React from "react";
 +
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
 +
 
 +
const App = () => (
 +
  <View style={[styles.container, styles.horizontal]}>
 +
    <ActivityIndicator />
 +
    <ActivityIndicator size="large" />
 +
    <ActivityIndicator size="small" color="#0000ff" />
 +
    <ActivityIndicator size="large" color="#00ff00" />
 +
  </View>
 +
);
 +
 
 +
const styles = StyleSheet.create({
 +
  container: {
 +
    flex: 1,
 +
    justifyContent: "center"
 
   },
 
   },
 
   horizontal: {
 
   horizontal: {
     flexDirection: 'row',
+
     flexDirection: "row",
     justifyContent: 'space-around',
+
     justifyContent: "space-around",
 
     padding: 10
 
     padding: 10
 
   }
 
   }
})
+
});
  
AppRegistry.registerComponent('App', () => App)
+
export default App;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 
== الخاصيات ==
 
== الخاصيات ==
* [[ReactNative/view|خاصيّات <code>View</code>]]
+
=== خاصيات <code>View</code>===
* <code>[[ReactNative/activityindicator#animating|animating]]</code>
+
موروثة من خاصيات المكون <code>[[ReactNative/view|View]]</code>.
* <code>[[ReactNative/activityindicator#color|color]]</code>
 
* <code>[[ReactNative/activityindicator#hidesWhenStopped|hidesWhenStopped]]</code>
 
* <code>[[ReactNative/activityindicator#size|size]]</code>
 
  
 
===<code>animating</code>===
 
===<code>animating</code>===
إظهار المؤشر (true، وهي القيمة الافتراضيّة) أو إخفاؤه (false).
+
إظهار المؤشر (true) أو إخفاؤه (false).
  
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
|-
 
|-
 
|قيمة منطقيّة
 
|قيمة منطقيّة
 
|لا
 
|لا
 +
|true
 
|}
 
|}
 
===<code>color</code>===
 
===<code>color</code>===
لون المؤشّر (الافتراضي هو الرمادي على نظام التشغيل iOS والسماوي الغامق على نظام Android).
+
لون المؤشّر .
  
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
|-
 
|-
 
|[[ReactNative/colors|color]]
 
|[[ReactNative/colors|color]]
 
|لا
 
|لا
 +
|<code>الرمادي '#999999'</code> على نظام التشغيل iOS
 +
 +
<code>null</code> (اللون الافتراضي للنظام) في نظام Android
 
|}
 
|}
  
 
===<code>hidesWhenStopped</code>===
 
===<code>hidesWhenStopped</code>===
ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating) (القيمة true افتراضيًا).
+
ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating).
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
!المنصة
 
!المنصة
 
|-
 
|-
 
|قيمة منطقيّة
 
|قيمة منطقيّة
 
|لا
 
|لا
 +
|true
 
|iOS
 
|iOS
 
|}
 
|}
 
===<code>size</code>===
 
===<code>size</code>===
حجم المؤشر ("small" افتراضيًا). تمرير عددٍ إلى هذه الخاصيّة مدعوم فقط على Android.
+
حجم المؤشر.
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 +
|-
 +
|enum('small', 'large')
 +
| rowspan="2" |لا
 +
| rowspan="2" |'small'
 
|-
 
|-
|enum('small', 'large') أو عدد
+
|عدد على Android
|لا
 
 
|}
 
|}
 
== مصادر ==
 
== مصادر ==
 
* [https://facebook.github.io/react-native/docs/activityindicator صفحة ActivityIndicator في توثيق React Native الرسمي.]
 
* [https://facebook.github.io/react-native/docs/activityindicator صفحة ActivityIndicator في توثيق React Native الرسمي.]
 
[[تصنيف:ReactNative]]
 
[[تصنيف:ReactNative]]
 +
[[تصنيف:React Native Component]]

المراجعة الحالية بتاريخ 14:01، 9 أكتوبر 2021

يعرض مؤشّر تحميل دائريّ.

مثال

import React, { Component } from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";

class App extends Component {
  render() {
    return (
      <View style={[styles.container, styles.horizontal]}>
        <ActivityIndicator />
        <ActivityIndicator size="large" />
        <ActivityIndicator size="small" color="#0000ff" />
        <ActivityIndicator size="large" color="#00ff00" />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center"
  },
  horizontal: {
    flexDirection: "row",
    justifyContent: "space-around",
    padding: 10
  }
});

export default App;
import React from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";

const App = () => (
  <View style={[styles.container, styles.horizontal]}>
    <ActivityIndicator />
    <ActivityIndicator size="large" />
    <ActivityIndicator size="small" color="#0000ff" />
    <ActivityIndicator size="large" color="#00ff00" />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center"
  },
  horizontal: {
    flexDirection: "row",
    justifyContent: "space-around",
    padding: 10
  }
});

export default App;

الخاصيات

خاصيات View

موروثة من خاصيات المكون View.

animating

إظهار المؤشر (true) أو إخفاؤه (false).

النوع مطلوب القيمة الافتراضية
قيمة منطقيّة لا true

color

لون المؤشّر .

النوع مطلوب القيمة الافتراضية
color لا الرمادي '#999999' على نظام التشغيل iOS

null (اللون الافتراضي للنظام) في نظام Android

hidesWhenStopped

ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating).

النوع مطلوب القيمة الافتراضية المنصة
قيمة منطقيّة لا true iOS

size

حجم المؤشر.

النوع مطلوب القيمة الافتراضية
enum('small', 'large') لا 'small'
عدد على Android

مصادر